package com.pet.shop.service.product;

import com.pet.shop.dto.PageDto;
import com.pet.shop.entity.product.ProductPic;
import com.pet.shop.mappers.product.ProductPicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ProductPicServiceImpl implements IProductPicService  {

    @Autowired
    private ProductPicMapper productPicMapper;

    @Override
    public int deleteEntity(Long id) {
        return productPicMapper.delete(id);
    }

    @Override
    public int deleteEntityList(List<Long> idList) {
        if(idList == null || idList.isEmpty()) return 0;
        int i = 0;
        for (Long id : idList) {
            i += productPicMapper.delete(id);
        }
        return i;
    }

    @Override
    public ProductPic insertEntity(ProductPic record) {
        return record;
    }

    @Override
    public ProductPic getEntity(Long id) {
        return productPicMapper.get(id);
    }

    @Override
    public int updateEntity(ProductPic record) {
        return productPicMapper.update(record);
    }

    @Override
    public PageDto<ProductPic> queryPage(PageDto<ProductPic> pageDto) {
        return null;
    }

    @Override
    public List<ProductPic> queryProductPicByParams(Map<String,Object> map){
        return productPicMapper.queryByParams(map);
    }
}
